Repository navigation
Release 0.11.2 - #56
Merged
Merged
Conversation
Layout, intrinsic sizing, inline collection and margin collapsing recurse per nesting level with large frames, so 45 nested divs (18 tables, 28 flex containers) overflowed a 1.5 MB stack and ended the process. Each of these walks now checks RuntimeHelpers.TryEnsureSufficientExecutionStack and leaves the rest of the subtree out instead.
Without the stack guard the test host crashes with a stack overflow.
A trial layout is laid out on its own, so the same inputs give the same result within one render. Nested tables and inline-blocks trial-laid out every level again for each level above it, doubling the work per level (20 nested tables took 16 s, 22 over a minute). Trials inside a trial, the ones the layout around them repeats, are now kept per element with their inputs (style map, width, inherited style, measuring mode) for the render, not inside a line-clamped box; incremental rendering drops them on every change.
Without the trial cache, 6 nested tables take 63 trial layouts and 12 take 4095 (2^depth - 1).
Laid out only a few times, the layout stays in the first JIT tier, whose frames are large: 12 nested inline-blocks overflowed the test thread's stack on macOS. With tiered compilation off, devel and the trial cache need the same stack.
Each of their levels lays out the levels below it twice, so up to the depth the stack allows the test never completed in CI. They come back once the nested trial layouts are reused (#54).
Reuse nested trial layouts within a render
…again With the nested trial layouts reused (#54), they render in well under a second.
Leave out deep subtrees instead of overflowing the stack
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Types of Changes
Prerequisites
Please make sure you can check the following two boxes:
Contribution Type
What types of changes does your code introduce? Put an
xin all the boxes that apply:Description
This pull request introduces version 0.11.2 of AngleSharp.Renderer, focusing on significant performance improvements, correctness fixes, and expanded test coverage. The main highlights are optimizations for deeply nested pages, more efficient handling of flex and table layouts, reduced memory allocations, and bug fixes for text node handling. It also adds new and improved tests to ensure robustness and correctness of these changes.
These changes collectively make AngleSharp.Renderer faster, more reliable, and better tested, especially for complex and deeply nested web pages.